Pin workspace Python interpreter to project .venv#244
Conversation
Add `python.defaultInterpreterPath` set to `${workspaceFolder}/.venv/bin/python`
so the VS Code Python extension consistently resolves this workspace's
interpreter on reload, rather than falling back to a user-level default that
may point at an unrelated project's venv.
Why: without an explicit workspace-level pin, the picker selection is
transient and the Python extension can re-activate the wrong interpreter
in integrated terminals on window reload, which causes `uv pip install` and
type checkers (e.g. Pyrefly) to silently target the wrong site-packages.
This mirrors the common Python project convention of a `.venv/` directory
at the repo root. Contributors using a different venv location can override
locally via the interpreter picker.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughVS Code workspace settings gain a ChangesWorkspace Configuration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.vscode/settings.json:
- Line 32: The workspace setting "python.defaultInterpreterPath" currently
points to the Unix-style path ".venv/bin/python" which fails on Windows; update
the project guidance by adding a short note in the repository README (or a new
.vscode/README) that documents the Windows equivalent
".venv\\Scripts\\python.exe" and instructs Windows contributors to create a
local override (or a platform-specific workspace settings file) pointing
"python.defaultInterpreterPath" to that path so their VS Code picks the correct
interpreter.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 9f0f05b5-9961-4a90-a3c7-6a468ba535ae
📒 Files selected for processing (1)
.vscode/settings.json
Address CodeRabbit feedback on the workspace interpreter pin: the path
`${workspaceFolder}/.venv/bin/python` is Unix-only and won't resolve on
Windows. Add a JSONC comment above the setting documenting the Windows
equivalent (`${workspaceFolder}/.venv/Scripts/python.exe`) so contributors
on that platform know to override locally via User Settings or the
interpreter picker.
`.vscode/settings.json` is officially JSONC, so the `//` comment is valid.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Proposed change
Adds
"python.defaultInterpreterPath": "\${workspaceFolder}/.venv/bin/python"to.vscode/settings.jsonso the VS Code Python extension consistently resolves this workspace's interpreter on reload.Without an explicit workspace-level pin, the picker selection is transient and the extension can fall back to a user-level
python.defaultInterpreterPaththat points at an unrelated project's venv. Combined with the existing"python.terminal.activateEnvInCurrentTerminal": true, that causes integrated terminals to silently activate the wrong venv on window reload, which makesuv pip installand type checkers (e.g. Pyrefly) target the wrong site-packages.The setting follows the common Python convention of a
.venv/at the repo root. Contributors using a different venv location can override locally via the interpreter picker. A JSONC comment above the line documents the Windows equivalent path (per CodeRabbit feedback already addressed).Type of change
Additional information
Checklist
🤖 Generated with Claude Code